package com.woniu.command.customerCommand;

import com.woniu.command.Command;
import com.woniu.command.handler.CustomerCommandHandler;
import com.woniu.outlet.po.CustomerPo;
import com.woniu.utils.ApplicationContextHolder;

public class AddCustomerCommand implements Command<CustomerPo, Integer> {

    private CustomerCommandHandler handler;

    public AddCustomerCommand() {
        //ApplicationContextHolder.getApplicationContext()拿到ApplicationContext
        this.handler = ApplicationContextHolder.getApplicationContext()
                .getBean(CustomerCommandHandler.class);
    }

    @Override
    public Integer execute(CustomerPo customerPo) {
        return this.handler.addCustomer(customerPo);
    }
}
